package in.iqing.control.adapter;

import android.app.Fragment;
import android.app.FragmentManager;
import android.support.v13.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by ZuoShu on 15/7/3.
 */
public class MainPagerAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragments;

    public MainPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    public void setFragments(List<Fragment> fragments) {
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments == null || fragments.size() == 0 ? null : fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments == null || fragments.size() == 0 ? 0 : fragments.size();
    }
}
